package com.ymatou.iapi.login.testcase;

import java.rmi.server.UID;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.google.gson.JsonObject;
import com.ymatou.iapi.login.parameter.*;
import com.ymatou.iapi.login.service.*;
import com.ymatou.iapi.userregister.parameter.UserRegisterInfoRequestDtoBean;
import com.ymatou.iapi.userregister.service.*;
import com.ymatou.iapi.userservice.parameter.enums.AppSourceEnum;
import com.ymatou.iapi.userservice.parameter.enums.TerminalSourceEnum;
import com.ymatou.iapi.userservice.parameter.enums.ThirdPartyTypeEnum;
import com.ymatou.iapi.userservice.parameter.req.BindThirdPartyUserReq;
import com.ymt.core.tool.FormatUtil;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P1;
import com.ymt.utils.tag.P3;
import com.ymttest.business.service.JUserCallService;
import com.ymttest.database.model.ThirdpartyUserbind;
import com.ymttest.database.model.ThirdpartyUserbindHistory;
import com.ymttest.database.sqlwapper.JUserWapper;
import com.ymttest.database.sqlwapper.YmtUsersWapper;
import com.ymttest.utils.TestDataManager;
import com.ymttest.utils.YMTDateUtil;
import com.ymttest.utils.constant.AppTypeChannel;
import com.ymttest.utils.constant.ECode;
import com.ymttest.utils.constant.ThirdPartyType;

/**
 * 解绑第三方用户接口 FreeMaker Template自动生成代码
 */
@TestSuite
public class Ts_UnBindThirdPartyAccountDto {
	private static UnBindThirdPartyAccountDtoBean unbindthirdpartyaccountdtoBean;
	private static UnBindThirdPartyAccountDtoCall unbindthirdpartyaccountdtoCall;
	private static YmtUsersWapper userWapper;

	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("解绑第三方用户接口");
		userWapper = new YmtUsersWapper();
	}

	@Before
	public void caseUp() {
		unbindthirdpartyaccountdtoBean = new UnBindThirdPartyAccountDtoBean();
		unbindthirdpartyaccountdtoCall = new UnBindThirdPartyAccountDtoCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(unbindthirdpartyaccountdtoCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}

	private AliUserRequestDtoBean createAliUserBean(String aliUserId) {
		AliUserRequestDtoBean aliuserregbean = new AliUserRequestDtoBean();
		aliuserregbean.setSAliUserId(aliUserId);
		aliuserregbean.setSRealName(aliUserId);
		aliuserregbean.setSEmail(TestDataManager.getEmail());
		aliuserregbean.setRegSource(AppSourceEnum.App);
		aliuserregbean.setTerminalSource(TerminalSourceEnum.IOS);
		aliuserregbean.setAppTypeChanndel(AppTypeChannel.NEW_CHANNEL);
		aliuserregbean.setMobile("13339857810");
		aliuserregbean.setClientIp("120.1.1.1");
		aliuserregbean.setTokenTimeOut((new Date()).getTime());
		aliuserregbean.setSGmt_Decay("sGmt_Decay");
		aliuserregbean.setSRealName("sRealNam");
		aliuserregbean.setSThirdParty("sThirdParty");
		aliuserregbean.setSToken("sToken");
		aliuserregbean.setSUserGrade("sUserGrade");
		aliuserregbean.setSUserGradeType("sUserGradeType");
		return aliuserregbean;
	}

	private WeiXinUserRequestDtoBean createWeiXinUserBean(String weiXinUserId) {
		WeiXinUserRequestDtoBean regBean = new WeiXinUserRequestDtoBean();
		String openId = "openId_" + TestDataManager.getRandomNum(4);
		regBean.setMobile("13339857810");
		regBean.setCountry("China");
		regBean.setProvince("Shanghai");
		regBean.setCity("Shanghai");
		regBean.setClientIp("1.1.1.1");
		regBean.setHeadimgurl("");
		regBean.setName("WeiXiUser_" + TestDataManager.getRandomNum(5));
		regBean.setOId(openId);
		regBean.setRegSource(AppSourceEnum.App);
		regBean.setSex("Femail");
		regBean.setTimeOut(new Date().getTime());
		regBean.setTSource(TerminalSourceEnum.PC);
		regBean.setAppTypeChanndel(AppTypeChannel.NEW_CHANNEL);
		// regBean.setMobile(phone);
		regBean.setUnionId(weiXinUserId);
		regBean.setWeixinToken("weixintoken_" + TestDataManager.getRandomNum(4));
		regBean.setDeviceId(TestDataManager.getRandomUUID().toString());
		return regBean;
	}

	private SinaWeiBoUserRequestDtoBean createWeiboUserBean(String weiboUserId) {
		SinaWeiBoUserRequestDtoBean regBean = new SinaWeiBoUserRequestDtoBean();
		regBean.setSWeiboUserId(weiboUserId);
		regBean.setSName("weiboTest_" + TestDataManager.getRandomNum(10));
		regBean.setSMail(TestDataManager.getEmail());
		regBean.setSMobile(TestDataManager.getPhoneNum());
		regBean.setClientIp("120.1.1.1");
		regBean.setDAddTime(YMTDateUtil.getBeforeOrNextDay(-1, YMTDateUtil.YMDTHMS_STRING));
		regBean.setTerminalSource(TerminalSourceEnum.IOS);
		regBean.setAppTypeChanndel(AppTypeChannel.NEW_CHANNEL);
		// regBean.setMobile(phone);
		regBean.setRegSource(AppSourceEnum.App);
		return regBean;
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_UnBindThirdPartyAccountDto_001() {
		Logger.start(true, "用户绑定了微信账号，微博账号，阿里账号，依次解绑这些账号");
		try {
			Logger.comment("前置条件准备");
			String phone = TestDataManager.getPhoneNum();
			List<Map> thirdParty = new ArrayList<Map>();

			String ali = "unionId_" + TestDataManager.getRandomNum(10);
			String wb = "unionId_" + TestDataManager.getRandomNum(10);
			String wx = "unionId_" + TestDataManager.getRandomNum(10);

			Logger.comment("创建账号,获取token");
			UserRegisterInfoRequestDtoCall urrc = JUserCallService.UserRegisterInfoRequestDtoCall(JUserCallService.initUserRegisterInfoRequestDtoBean());
			JsonObject result = urrc.getJsonObject().get("Result").getAsJsonObject();
			String token = result.get("Token").getAsString();
			int UserId = urrc.getUserid();

			Logger.comment("bind阿里账号");
			BindAliUserRequestDtoBean bindaliuserrequestdtoBean = new BindAliUserRequestDtoBean();
			BindAliUserRequestDtoCall bindaliuserrequestdtoCall = new BindAliUserRequestDtoCall();

			bindaliuserrequestdtoBean.setToken(token);
			bindaliuserrequestdtoBean.setClientType("1");
			bindaliuserrequestdtoBean.setAliUser(createAliUserBean(ali));

			bindaliuserrequestdtoCall.setData(bindaliuserrequestdtoBean);
			bindaliuserrequestdtoCall.callService();

			Logger.verifyEquals(ECode.SUCCESS, ((Double) bindaliuserrequestdtoCall.getMap().get("ResponseCode")).intValue() + "", "验证Code信息");
			Logger.verifyEquals(true, bindaliuserrequestdtoCall.getMap().get("Success"), "验证操作成功");

			Logger.comment("bind微信账号");
			BindWeiXinUseroRequestDtoBean bindweixinuserorequestdtoBean = new BindWeiXinUseroRequestDtoBean();
			BindWeiXinUseroRequestDtoCall bindweixinuserorequestdtoCall = new BindWeiXinUseroRequestDtoCall();

			bindweixinuserorequestdtoBean.setToken(token);
			bindweixinuserorequestdtoBean.setClientType("1");
			bindweixinuserorequestdtoBean.setWeiXinUser(createWeiXinUserBean(wx));

			bindweixinuserorequestdtoCall.setData(bindweixinuserorequestdtoBean);
			bindweixinuserorequestdtoCall.callService();

			Logger.verifyEquals(ECode.SUCCESS, ((Double) bindweixinuserorequestdtoCall.getMap().get("ResponseCode")).intValue() + "", "验证Code信息");
			Logger.verifyEquals(true, bindweixinuserorequestdtoCall.getMap().get("Success"), "验证操作成功");

			Logger.comment("bind微博账号");
			BindSinaWeiboUserRequestDtoBean bindsinaweibouserrequestdtoBean = new BindSinaWeiboUserRequestDtoBean();
			BindSinaWeiboUserRequestDtoCall bindsinaweibouserrequestdtoCall = new BindSinaWeiboUserRequestDtoCall();

			bindsinaweibouserrequestdtoBean.setToken(token);
			bindsinaweibouserrequestdtoBean.setClientType("1");
			bindsinaweibouserrequestdtoBean.setWeiBoUser(createWeiboUserBean(wb));

			bindsinaweibouserrequestdtoCall.setData(bindsinaweibouserrequestdtoBean);
			bindsinaweibouserrequestdtoCall.callService();

			Logger.verifyEquals(ECode.SUCCESS, ((Double) bindsinaweibouserrequestdtoCall.getMap().get("ResponseCode")).intValue() + "", "验证Code信息");
			Logger.verifyEquals(true, bindsinaweibouserrequestdtoCall.getMap().get("Success"), "验证操作成功");

			JUserWapper ju = new JUserWapper();
			List<ThirdpartyUserbind> thirdinfoes = ju.selectthirdpartyuserbind(UserId);
			Logger.verifyEquals(3, thirdinfoes.size(), "验证数据库中相应thirdparty_userbind记录数");

			List<ThirdpartyUserbindHistory> thirdinfohistorys = ju.selectthirdpartyuserbindhistory(UserId);
			Logger.verifyEquals(3, thirdinfohistorys.size(), "验证数据库中相应thirdparty_userbind_History记录数");

			Logger.comment("unbind阿里账号");
			unbindthirdpartyaccountdtoBean.setThirdPartyId(ali);
			unbindthirdpartyaccountdtoBean.setThirdPartyType(ThirdPartyType.ALI);
			unbindthirdpartyaccountdtoBean.setUserId(UserId);

			unbindthirdpartyaccountdtoCall.setData(unbindthirdpartyaccountdtoBean);
			unbindthirdpartyaccountdtoCall.callService();

			Logger.verifyEquals(200, ((Double) unbindthirdpartyaccountdtoCall.getMap().get("ResponseCode")).intValue(), "验证Code信息");

			Logger.comment("unbind微博账号");
			unbindthirdpartyaccountdtoBean.setThirdPartyId(wb);
			unbindthirdpartyaccountdtoBean.setThirdPartyType(ThirdPartyType.WEIBO);
			unbindthirdpartyaccountdtoBean.setUserId(UserId);

			unbindthirdpartyaccountdtoCall.setData(unbindthirdpartyaccountdtoBean);
			unbindthirdpartyaccountdtoCall.callService();

			Logger.verifyEquals(200, ((Double) unbindthirdpartyaccountdtoCall.getMap().get("ResponseCode")).intValue(), "验证Code信息");

			Logger.comment("unbind微信账号");
			unbindthirdpartyaccountdtoBean.setThirdPartyId(wx);
			unbindthirdpartyaccountdtoBean.setThirdPartyType(ThirdPartyType.WEIXIN);
			unbindthirdpartyaccountdtoBean.setUserId(UserId);

			unbindthirdpartyaccountdtoCall.setData(unbindthirdpartyaccountdtoBean);
			unbindthirdpartyaccountdtoCall.callService();

			Logger.verifyEquals(200, ((Double) unbindthirdpartyaccountdtoCall.getMap().get("ResponseCode")).intValue(), "验证Code信息");
			Logger.verifyEquals("true", unbindthirdpartyaccountdtoCall.getMap().get("Success").toString(), "验证Code信息");

			Thread.sleep(1000);

			// 验证thirdparty_userbind表相应记录被删除
			List<ThirdpartyUserbind> thirdinfoes1 = new JUserWapper().selectthirdpartyuserbind(UserId);
			Logger.verifyEquals(0, thirdinfoes1.size(), "验证数据库中相应thirdparty_userbind记录数");

			// 验证thirdparty_userbind_history表解绑记录
			List<ThirdpartyUserbindHistory> thirdinfohistorys1 = new JUserWapper().selectthirdpartyuserbindhistory(UserId);
			Logger.verifyEquals(6, thirdinfohistorys1.size(), "验证数据库中相应thirdparty_userbind_History记录数");

			for (int i = 0; i < 3; i++) {
				Logger.verifyEquals(false, thirdinfohistorys1.get(i).getBinding(),
						"验证数据库中相应thirdparty_userbind_History中RecordId=" + thirdinfohistorys1.get(i).getRecordId() + "的Binding");
			}
			for (int i = 3; i < 6; i++) {
				Logger.verifyEquals(true, thirdinfohistorys1.get(i).getBinding(),
						"验证数据库中相应thirdparty_userbind_History中RecordId=" + thirdinfohistorys1.get(i).getRecordId() + "的Binding");
			}
			Logger.verifyEquals(6, thirdinfohistorys1.get(0).getThirdPartyType(),
					"验证数据库中相应thirdparty_userbind_History中RecordId=" + thirdinfohistorys1.get(0).getRecordId() + "的ThirdPartyType");
			Logger.verifyEquals(5, thirdinfohistorys1.get(1).getThirdPartyType(),
					"验证数据库中相应thirdparty_userbind_History中RecordId=" + thirdinfohistorys1.get(1).getRecordId() + "的ThirdPartyType");
			Logger.verifyEquals(3, thirdinfohistorys1.get(2).getThirdPartyType(),
					"验证数据库中相应thirdparty_userbind_History中RecordId=" + thirdinfohistorys1.get(2).getRecordId() + "的ThirdPartyType");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_UnBindThirdPartyAccountDto_002() {
		Logger.start(false, "用户只绑定了阿里账号，解绑阿里账号，提示不能解绑，需要设置登录信息");
		try {

			AliUserRequestDtoBean aliUserRequestDtoBean = JUserCallService.initAliUserRequestDtoBean();
			String phone = TestDataManager.getPhoneNum();
			aliUserRequestDtoBean.setMobile(phone);
			AliUserRequestDtoCall aliUserRequestDtoCall = JUserCallService.aliUserRequestDto(aliUserRequestDtoBean);

			Integer uid = aliUserRequestDtoCall.getJsonObject().get("Result").getAsJsonObject().get("UserId").getAsInt();
			String token = aliUserRequestDtoCall.getJsonObject().get("Result").getAsJsonObject().get("Token").getAsString();

			unbindthirdpartyaccountdtoBean = JUserCallService.initUnBindThirdPartyAccountDtoBean(aliUserRequestDtoBean.getSAliUserId(), ThirdPartyType.ALI, uid);
			unbindthirdpartyaccountdtoCall = JUserCallService.unBindThirdPartyAccountDto(unbindthirdpartyaccountdtoBean);

			Logger.verifyEquals(300, ((Double) unbindthirdpartyaccountdtoCall.getMap().get("ResponseCode")).intValue(), "验证Code信息");
			Logger.verifyEquals("false", unbindthirdpartyaccountdtoCall.getMap().get("Success").toString(), "验证Success信息");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_UnBindThirdPartyAccountDto_003() {
		Logger.start(false, "用户未绑定第三方账号，解绑失败");
		try {
			Logger.comment("前置准备：新创建一个用户");
			UserRegisterInfoRequestDtoBean regbean = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall urrc = JUserCallService.UserRegisterInfoRequestDtoCall(regbean);

			JsonObject registerResult = urrc.getJsonObject().get("Result").getAsJsonObject();
			String token = registerResult.get("Token").getAsString();
			int userId = urrc.getUserid();

			String ali = "NewBindAli_" + TestDataManager.getRandomNum(10);

			unbindthirdpartyaccountdtoBean.setThirdPartyId(ali);
			unbindthirdpartyaccountdtoBean.setThirdPartyType(ThirdPartyType.ALI);
			unbindthirdpartyaccountdtoBean.setUserId(userId);

			unbindthirdpartyaccountdtoCall.setData(unbindthirdpartyaccountdtoBean);
			unbindthirdpartyaccountdtoCall.callService();

			Logger.verifyEquals(404, ((Double) unbindthirdpartyaccountdtoCall.getMap().get("ResponseCode")).intValue(), "验证Code信息");
			Logger.verifyEquals("false", unbindthirdpartyaccountdtoCall.getMap().get("Success").toString(), "验证Success信息");
			Logger.verifyEquals("此第三方账号不存在，无法解绑", unbindthirdpartyaccountdtoCall.getMap().get("LastErrorMessage").toString(), "验证LastErrorMessage信息");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_UnBindThirdPartyAccountDto_004() {
		// 幂等 返回成功
		Logger.start(false, "第三方账号注册后,传入错误的第三方账号解绑,失败");
		try {
			Logger.comment("前置条件准备");
			String phone = TestDataManager.getPhoneNum();
			List<Map> thirdParty = new ArrayList<Map>();

			String ali = "unionId_" + TestDataManager.getRandomNum(10);
			String wb = "unionId_" + TestDataManager.getRandomNum(10);
			String wx = "unionId_" + TestDataManager.getRandomNum(10);
			String other = "unionId_" + TestDataManager.getRandomNum(10);

			Logger.comment("创建账号,获取token");
			UserRegisterInfoRequestDtoCall urrc = JUserCallService.UserRegisterInfoRequestDtoCall(JUserCallService.initUserRegisterInfoRequestDtoBean());
			JsonObject result = urrc.getJsonObject().get("Result").getAsJsonObject();
			String token = result.get("Token").getAsString();
			int UserId = urrc.getUserid();
			Thread.sleep(500);
			Logger.comment("bind阿里账号");
			BindAliUserRequestDtoBean bindaliuserrequestdtoBean = new BindAliUserRequestDtoBean();
			BindAliUserRequestDtoCall bindaliuserrequestdtoCall = new BindAliUserRequestDtoCall();

			bindaliuserrequestdtoBean.setToken(token);
			bindaliuserrequestdtoBean.setClientType("1");
			bindaliuserrequestdtoBean.setAliUser(createAliUserBean(ali));

			bindaliuserrequestdtoCall.setData(bindaliuserrequestdtoBean);
			bindaliuserrequestdtoCall.callService();

			Logger.verifyEquals(ECode.SUCCESS, ((Double) bindaliuserrequestdtoCall.getMap().get("ResponseCode")).intValue() + "", "验证Code信息");
			Logger.verifyEquals(true, bindaliuserrequestdtoCall.getMap().get("Success"), "验证操作成功");

			Logger.comment("bind微信账号");
			BindWeiXinUseroRequestDtoBean bindweixinuserorequestdtoBean = new BindWeiXinUseroRequestDtoBean();
			BindWeiXinUseroRequestDtoCall bindweixinuserorequestdtoCall = new BindWeiXinUseroRequestDtoCall();

			bindweixinuserorequestdtoBean.setToken(token);
			bindweixinuserorequestdtoBean.setClientType("1");
			bindweixinuserorequestdtoBean.setWeiXinUser(createWeiXinUserBean(wx));

			bindweixinuserorequestdtoCall.setData(bindweixinuserorequestdtoBean);
			bindweixinuserorequestdtoCall.callService();

			Logger.verifyEquals(ECode.SUCCESS, ((Double) bindweixinuserorequestdtoCall.getMap().get("ResponseCode")).intValue() + "", "验证Code信息");
			Logger.verifyEquals(true, bindweixinuserorequestdtoCall.getMap().get("Success"), "验证操作成功");

			Logger.comment("bind微博账号");
			BindSinaWeiboUserRequestDtoBean bindsinaweibouserrequestdtoBean = new BindSinaWeiboUserRequestDtoBean();
			BindSinaWeiboUserRequestDtoCall bindsinaweibouserrequestdtoCall = new BindSinaWeiboUserRequestDtoCall();

			bindsinaweibouserrequestdtoBean.setToken(token);
			bindsinaweibouserrequestdtoBean.setClientType("1");
			bindsinaweibouserrequestdtoBean.setWeiBoUser(createWeiboUserBean(wb));

			bindsinaweibouserrequestdtoCall.setData(bindsinaweibouserrequestdtoBean);
			bindsinaweibouserrequestdtoCall.callService();

			Logger.verifyEquals(ECode.SUCCESS, ((Double) bindsinaweibouserrequestdtoCall.getMap().get("ResponseCode")).intValue() + "", "验证Code信息");
			Logger.verifyEquals(true, bindsinaweibouserrequestdtoCall.getMap().get("Success"), "验证操作成功");

			Logger.comment("unbind阿里账号");
			unbindthirdpartyaccountdtoBean.setThirdPartyId(other);
			unbindthirdpartyaccountdtoBean.setThirdPartyType(ThirdPartyType.ALI);
			unbindthirdpartyaccountdtoBean.setUserId(UserId);

			unbindthirdpartyaccountdtoCall.setData(unbindthirdpartyaccountdtoBean);
			unbindthirdpartyaccountdtoCall.callService();

			Logger.verifyEquals(200, ((Double) unbindthirdpartyaccountdtoCall.getMap().get("ResponseCode")).intValue(), "验证Code信息");
			Logger.verifyEquals("true", unbindthirdpartyaccountdtoCall.getMap().get("Success").toString(), "验证Success信息");

			Logger.comment("unbind微博账号");
			unbindthirdpartyaccountdtoBean.setThirdPartyId(other);
			unbindthirdpartyaccountdtoBean.setThirdPartyType(ThirdPartyType.WEIBO);
			unbindthirdpartyaccountdtoBean.setUserId(UserId);

			unbindthirdpartyaccountdtoCall.setData(unbindthirdpartyaccountdtoBean);
			unbindthirdpartyaccountdtoCall.callService();

			Logger.verifyEquals(200, ((Double) unbindthirdpartyaccountdtoCall.getMap().get("ResponseCode")).intValue(), "验证Code信息");
			Logger.verifyEquals("true", unbindthirdpartyaccountdtoCall.getMap().get("Success").toString(), "验证Success信息");

			Logger.comment("unbind微信账号");
			unbindthirdpartyaccountdtoBean.setThirdPartyId(other);
			unbindthirdpartyaccountdtoBean.setThirdPartyType(ThirdPartyType.WEIXIN);
			unbindthirdpartyaccountdtoBean.setUserId(UserId);

			unbindthirdpartyaccountdtoCall.setData(unbindthirdpartyaccountdtoBean);
			unbindthirdpartyaccountdtoCall.callService();

			Logger.verifyEquals(200, ((Double) unbindthirdpartyaccountdtoCall.getMap().get("ResponseCode")).intValue(), "验证Code信息");
			Logger.verifyEquals("true", unbindthirdpartyaccountdtoCall.getMap().get("Success").toString(), "验证Success信息");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_UnBindThirdPartyAccountDto_005() {
		Logger.start(true, "手机注册账号，绑定微博账号，解绑成功");
		try {
			Logger.comment("前置条件准备");
			String wb = "unionId_" + TestDataManager.getRandomNum(10);

			Logger.comment("创建账号,获取token");
			UserRegisterInfoRequestDtoBean userRegisterInfoRequestDtoBean = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall urrc = JUserCallService.UserRegisterInfoRequestDtoCall(userRegisterInfoRequestDtoBean);
			JsonObject result = urrc.getJsonObject().get("Result").getAsJsonObject();
			String token = result.get("Token").getAsString();
			int userId = urrc.getUserid();
			Thread.sleep(1000);
			Logger.comment("bind微博账号");
			BindSinaWeiboUserRequestDtoBean bindsinaweibouserrequestdtoBean = new BindSinaWeiboUserRequestDtoBean();
			BindSinaWeiboUserRequestDtoCall bindsinaweibouserrequestdtoCall = new BindSinaWeiboUserRequestDtoCall();

			bindsinaweibouserrequestdtoBean.setToken(token);
			bindsinaweibouserrequestdtoBean.setClientType("1");
			bindsinaweibouserrequestdtoBean.setWeiBoUser(createWeiboUserBean(wb));

			bindsinaweibouserrequestdtoCall.setData(bindsinaweibouserrequestdtoBean);
			bindsinaweibouserrequestdtoCall.callService();

			Logger.verifyEquals(ECode.SUCCESS, ((Double) bindsinaweibouserrequestdtoCall.getMap().get("ResponseCode")).intValue() + "", "验证Code信息");
			Logger.verifyEquals(true, bindsinaweibouserrequestdtoCall.getMap().get("Success"), "验证操作成功");

			Logger.comment("unbind微博账号");
			unbindthirdpartyaccountdtoBean.setThirdPartyId(wb);
			unbindthirdpartyaccountdtoBean.setThirdPartyType(ThirdPartyType.WEIBO);
			unbindthirdpartyaccountdtoBean.setUserId(userId);

			unbindthirdpartyaccountdtoCall.setData(unbindthirdpartyaccountdtoBean);
			unbindthirdpartyaccountdtoCall.callService();

			Logger.verifyEquals(200, ((Double) unbindthirdpartyaccountdtoCall.getMap().get("ResponseCode")).intValue(), "验证Code信息");
			Logger.verifyEquals("true", unbindthirdpartyaccountdtoCall.getMap().get("Success").toString(), "验证Code信息");

			// Logger.comment("验证数据库");
			// verifyDB(userId, bindaliuserrequestdtoBean.getAliUser());

			Logger.comment("验证用该账号码头登陆成功");
			LoginAuthCall lac = JUserCallService.login(userRegisterInfoRequestDtoBean.getLoginId(), userRegisterInfoRequestDtoBean.getPas(), "app",
					userRegisterInfoRequestDtoBean.getClientIp(), userRegisterInfoRequestDtoBean.getDeviceId());
			Logger.verifyEquals(true, lac.getSuccess(), "验证Success");
			Logger.verifyEquals(userRegisterInfoRequestDtoBean.getLoginMobile(), lac.getUserData().getLoginMobile(), "验证UserName");

			Logger.comment("验证微博联合登陆失败");
			SinaWeiBoUserRequestDtoBean aliUserRequestDtoBean = bindsinaweibouserrequestdtoBean.getWeiBoUser();
			aliUserRequestDtoBean.setIYmtUserId(userId);
			aliUserRequestDtoBean.setMobile(null);
			SinaWeiBoUserRequestDtoCall aliUserRequestDtoCall = JUserCallService.sinaWeiBoUserRequestDto(aliUserRequestDtoBean);
			Logger.verifyEquals(ECode.FAILED400, aliUserRequestDtoCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("false", aliUserRequestDtoCall.getString("Success"), "验证是否成功");
			Logger.verifyEquals("为了您的账户安全，请绑定你的手机号码", aliUserRequestDtoCall.getString("LastErrorMessage"), "验证LastErrorMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_UnBindThirdPartyAccountDto_006() {
		Logger.start(true, "邮箱注册账号，绑定微信账号，解绑成功");
		try {

			Logger.comment("创建账号,获取token");
			UserRegisterInfoRequestDtoBean serRegisterInfoRequestDtoBean = JUserCallService.initUserRegisterInfoRequestDtoBean();
			// serRegisterInfoRequestDtoBean.setLoginMobile(null);
			UserRegisterInfoRequestDtoCall urrc = JUserCallService.UserRegisterInfoRequestDtoCall(serRegisterInfoRequestDtoBean);

			JsonObject result = urrc.getJsonObject().get("Result").getAsJsonObject();
			String token = result.get("Token").getAsString();
			int UserId = urrc.getUserid();

			Logger.comment("bind微信账号");
			String wx = "unionId_" + TestDataManager.getRandomNum(10);
			BindWeiXinUseroRequestDtoBean bindweixinuserorequestdtoBean = new BindWeiXinUseroRequestDtoBean();
			BindWeiXinUseroRequestDtoCall bindweixinuserorequestdtoCall = new BindWeiXinUseroRequestDtoCall();

			bindweixinuserorequestdtoBean.setToken(token);
			bindweixinuserorequestdtoBean.setClientType("1");
			bindweixinuserorequestdtoBean.setWeiXinUser(createWeiXinUserBean(wx));

			bindweixinuserorequestdtoCall.setData(bindweixinuserorequestdtoBean);
			bindweixinuserorequestdtoCall.callService();

			Logger.comment("unbind微信账号");
			unbindthirdpartyaccountdtoBean.setThirdPartyId(wx);
			unbindthirdpartyaccountdtoBean.setThirdPartyType(ThirdPartyType.WEIXIN);
			unbindthirdpartyaccountdtoBean.setUserId(UserId);

			unbindthirdpartyaccountdtoCall.setData(unbindthirdpartyaccountdtoBean);
			unbindthirdpartyaccountdtoCall.callService();

			Logger.verifyEquals(200, ((Double) unbindthirdpartyaccountdtoCall.getMap().get("ResponseCode")).intValue(), "验证Code信息");
			Logger.verifyEquals("true", unbindthirdpartyaccountdtoCall.getMap().get("Success").toString(), "验证Code信息");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_UnBindThirdPartyAccountDto_007() {
		Logger.start(true, "不输入第三方账号,用户绑定了微信账号，微博账号，阿里账号，依次解绑这些账号");
		try {
			Logger.comment("前置条件准备");
			String phone = TestDataManager.getPhoneNum();
			List<Map> thirdParty = new ArrayList<Map>();

			String ali = "unionId_" + TestDataManager.getRandomNum(10);
			String wb = "unionId_" + TestDataManager.getRandomNum(10);
			String wx = "unionId_" + TestDataManager.getRandomNum(10);

			Logger.comment("创建账号,获取token");
			UserRegisterInfoRequestDtoBean serRegisterInfoRequestDtoBean = JUserCallService.initUserRegisterInfoRequestDtoBean();
			// serRegisterInfoRequestDtoBean.setLoginMobile(null);
			UserRegisterInfoRequestDtoCall urrc = JUserCallService.UserRegisterInfoRequestDtoCall(serRegisterInfoRequestDtoBean);

			JsonObject result = urrc.getJsonObject().get("Result").getAsJsonObject();
			String token = result.get("Token").getAsString();
			int UserId = urrc.getUserid();

			Logger.comment("bind阿里账号");
			BindAliUserRequestDtoBean bindaliuserrequestdtoBean = new BindAliUserRequestDtoBean();
			BindAliUserRequestDtoCall bindaliuserrequestdtoCall = new BindAliUserRequestDtoCall();

			bindaliuserrequestdtoBean.setToken(token);
			bindaliuserrequestdtoBean.setClientType("1");
			bindaliuserrequestdtoBean.setAliUser(createAliUserBean(ali));

			bindaliuserrequestdtoCall.setData(bindaliuserrequestdtoBean);
			bindaliuserrequestdtoCall.callService();

			Logger.verifyEquals(ECode.SUCCESS, ((Double) bindaliuserrequestdtoCall.getMap().get("ResponseCode")).intValue() + "", "验证Code信息");
			Logger.verifyEquals(true, bindaliuserrequestdtoCall.getMap().get("Success"), "验证操作成功");

			Logger.comment("bind微信账号");
			BindWeiXinUseroRequestDtoBean bindweixinuserorequestdtoBean = new BindWeiXinUseroRequestDtoBean();
			BindWeiXinUseroRequestDtoCall bindweixinuserorequestdtoCall = new BindWeiXinUseroRequestDtoCall();

			bindweixinuserorequestdtoBean.setToken(token);
			bindweixinuserorequestdtoBean.setClientType("1");
			bindweixinuserorequestdtoBean.setWeiXinUser(createWeiXinUserBean(wx));

			bindweixinuserorequestdtoCall.setData(bindweixinuserorequestdtoBean);
			bindweixinuserorequestdtoCall.callService();

			Logger.verifyEquals(ECode.SUCCESS, ((Double) bindweixinuserorequestdtoCall.getMap().get("ResponseCode")).intValue() + "", "验证Code信息");
			Logger.verifyEquals(true, bindweixinuserorequestdtoCall.getMap().get("Success"), "验证操作成功");

			Logger.comment("bind微博账号");
			BindSinaWeiboUserRequestDtoBean bindsinaweibouserrequestdtoBean = new BindSinaWeiboUserRequestDtoBean();
			BindSinaWeiboUserRequestDtoCall bindsinaweibouserrequestdtoCall = new BindSinaWeiboUserRequestDtoCall();

			bindsinaweibouserrequestdtoBean.setToken(token);
			bindsinaweibouserrequestdtoBean.setClientType("1");
			bindsinaweibouserrequestdtoBean.setWeiBoUser(createWeiboUserBean(wb));

			bindsinaweibouserrequestdtoCall.setData(bindsinaweibouserrequestdtoBean);
			bindsinaweibouserrequestdtoCall.callService();

			Logger.verifyEquals(ECode.SUCCESS, ((Double) bindsinaweibouserrequestdtoCall.getMap().get("ResponseCode")).intValue() + "", "验证Code信息");
			Logger.verifyEquals(true, bindsinaweibouserrequestdtoCall.getMap().get("Success"), "验证操作成功");

			Logger.comment("unbind阿里账号");
			unbindthirdpartyaccountdtoBean.setThirdPartyId(null);
			unbindthirdpartyaccountdtoBean.setThirdPartyType(ThirdPartyType.ALI);
			unbindthirdpartyaccountdtoBean.setUserId(UserId);

			unbindthirdpartyaccountdtoCall.setData(unbindthirdpartyaccountdtoBean);
			unbindthirdpartyaccountdtoCall.callService();

			Logger.verifyEquals(200, ((Double) unbindthirdpartyaccountdtoCall.getMap().get("ResponseCode")).intValue(), "验证Code信息");

			Logger.comment("unbind微博账号");
			unbindthirdpartyaccountdtoBean.setThirdPartyId(null);
			unbindthirdpartyaccountdtoBean.setThirdPartyType(ThirdPartyType.WEIBO);
			unbindthirdpartyaccountdtoBean.setUserId(UserId);

			unbindthirdpartyaccountdtoCall.setData(unbindthirdpartyaccountdtoBean);
			unbindthirdpartyaccountdtoCall.callService();

			Logger.verifyEquals(200, ((Double) unbindthirdpartyaccountdtoCall.getMap().get("ResponseCode")).intValue(), "验证Code信息");

			Logger.comment("unbind微信账号");
			unbindthirdpartyaccountdtoBean.setThirdPartyId(null);
			unbindthirdpartyaccountdtoBean.setThirdPartyType(ThirdPartyType.WEIXIN);
			unbindthirdpartyaccountdtoBean.setUserId(UserId);

			unbindthirdpartyaccountdtoCall.setData(unbindthirdpartyaccountdtoBean);
			unbindthirdpartyaccountdtoCall.callService();

			Logger.verifyEquals(200, ((Double) unbindthirdpartyaccountdtoCall.getMap().get("ResponseCode")).intValue(), "验证Code信息");
			Logger.verifyEquals("true", unbindthirdpartyaccountdtoCall.getMap().get("Success").toString(), "验证Code信息");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_UnBindThirdPartyAccountDto_008() {
		Logger.start(true, "不输入第三方账号,用户绑定了微信账号，微博账号，阿里账号，依次解绑这些账号,解绑后再次绑定成功");
		try {

			Logger.comment("前置条件准备");
			String phone = TestDataManager.getPhoneNum();
			List<Map> thirdParty = new ArrayList<Map>();

			String ali = "unionId_" + TestDataManager.getRandomNum(10);
			String wb = "unionId_" + TestDataManager.getRandomNum(10);
			String wx = "unionId_" + TestDataManager.getRandomNum(10);

			Logger.comment("创建账号,获取token");
			UserRegisterInfoRequestDtoBean serRegisterInfoRequestDtoBean = JUserCallService.initUserRegisterInfoRequestDtoBean();
			// serRegisterInfoRequestDtoBean.setLoginMobile(null);
			UserRegisterInfoRequestDtoCall urrc = JUserCallService.UserRegisterInfoRequestDtoCall(serRegisterInfoRequestDtoBean);

			JsonObject result = urrc.getJsonObject().get("Result").getAsJsonObject();
			String token = result.get("Token").getAsString();
			int UserId = urrc.getUserid();

			Logger.comment("bind阿里账号");
			BindAliUserRequestDtoBean bindaliuserrequestdtoBean = new BindAliUserRequestDtoBean();
			BindAliUserRequestDtoCall bindaliuserrequestdtoCall = new BindAliUserRequestDtoCall();

			bindaliuserrequestdtoBean.setToken(token);
			bindaliuserrequestdtoBean.setClientType("1");
			bindaliuserrequestdtoBean.setAliUser(createAliUserBean(ali));

			bindaliuserrequestdtoCall.setData(bindaliuserrequestdtoBean);
			bindaliuserrequestdtoCall.callService();

			Logger.verifyEquals(ECode.SUCCESS, ((Double) bindaliuserrequestdtoCall.getMap().get("ResponseCode")).intValue() + "", "验证Code信息");
			Logger.verifyEquals(true, bindaliuserrequestdtoCall.getMap().get("Success"), "验证操作成功");

			Logger.comment("bind微信账号");
			BindWeiXinUseroRequestDtoBean bindweixinuserorequestdtoBean = new BindWeiXinUseroRequestDtoBean();
			BindWeiXinUseroRequestDtoCall bindweixinuserorequestdtoCall = new BindWeiXinUseroRequestDtoCall();

			bindweixinuserorequestdtoBean.setToken(token);
			bindweixinuserorequestdtoBean.setClientType("1");
			bindweixinuserorequestdtoBean.setWeiXinUser(createWeiXinUserBean(wx));

			bindweixinuserorequestdtoCall.setData(bindweixinuserorequestdtoBean);
			bindweixinuserorequestdtoCall.callService();

			Logger.verifyEquals(ECode.SUCCESS, ((Double) bindweixinuserorequestdtoCall.getMap().get("ResponseCode")).intValue() + "", "验证Code信息");
			Logger.verifyEquals(true, bindweixinuserorequestdtoCall.getMap().get("Success"), "验证操作成功");

			Logger.comment("bind微博账号");
			BindSinaWeiboUserRequestDtoBean bindsinaweibouserrequestdtoBean = new BindSinaWeiboUserRequestDtoBean();
			BindSinaWeiboUserRequestDtoCall bindsinaweibouserrequestdtoCall = new BindSinaWeiboUserRequestDtoCall();

			bindsinaweibouserrequestdtoBean.setToken(token);
			bindsinaweibouserrequestdtoBean.setClientType("1");
			bindsinaweibouserrequestdtoBean.setWeiBoUser(createWeiboUserBean(wb));

			bindsinaweibouserrequestdtoCall.setData(bindsinaweibouserrequestdtoBean);
			bindsinaweibouserrequestdtoCall.callService();

			Logger.verifyEquals(ECode.SUCCESS, ((Double) bindsinaweibouserrequestdtoCall.getMap().get("ResponseCode")).intValue() + "", "验证Code信息");
			Logger.verifyEquals(true, bindsinaweibouserrequestdtoCall.getMap().get("Success"), "验证操作成功");

			Logger.comment("unbind阿里账号");
			unbindthirdpartyaccountdtoBean.setThirdPartyId(ali);
			unbindthirdpartyaccountdtoBean.setThirdPartyType(ThirdPartyType.ALI);
			unbindthirdpartyaccountdtoBean.setUserId(UserId);

			unbindthirdpartyaccountdtoCall.setData(unbindthirdpartyaccountdtoBean);
			unbindthirdpartyaccountdtoCall.callService();

			Logger.verifyEquals(200, ((Double) unbindthirdpartyaccountdtoCall.getMap().get("ResponseCode")).intValue(), "验证Code信息");

			Logger.comment("unbind微博账号");
			unbindthirdpartyaccountdtoBean.setThirdPartyId(wb);
			unbindthirdpartyaccountdtoBean.setThirdPartyType(ThirdPartyType.WEIBO);
			unbindthirdpartyaccountdtoBean.setUserId(UserId);

			unbindthirdpartyaccountdtoCall.setData(unbindthirdpartyaccountdtoBean);
			unbindthirdpartyaccountdtoCall.callService();

			Logger.verifyEquals(200, ((Double) unbindthirdpartyaccountdtoCall.getMap().get("ResponseCode")).intValue(), "验证Code信息");

			Logger.comment("unbind微信账号");
			unbindthirdpartyaccountdtoBean.setThirdPartyId(wx);
			unbindthirdpartyaccountdtoBean.setThirdPartyType(ThirdPartyType.WEIXIN);
			unbindthirdpartyaccountdtoBean.setUserId(UserId);

			unbindthirdpartyaccountdtoCall.setData(unbindthirdpartyaccountdtoBean);
			unbindthirdpartyaccountdtoCall.callService();

			Logger.verifyEquals(200, ((Double) unbindthirdpartyaccountdtoCall.getMap().get("ResponseCode")).intValue(), "验证Code信息");
			Logger.verifyEquals("true", unbindthirdpartyaccountdtoCall.getMap().get("Success").toString(), "验证Code信息");

			Logger.comment("再次bind阿里账号");
			bindaliuserrequestdtoCall.setData(bindaliuserrequestdtoBean);
			bindaliuserrequestdtoCall.callService();

			Logger.verifyEquals(ECode.SUCCESS, ((Double) bindaliuserrequestdtoCall.getMap().get("ResponseCode")).intValue() + "", "验证Code信息");
			Logger.verifyEquals(true, bindaliuserrequestdtoCall.getMap().get("Success"), "验证操作成功");

			Logger.comment("再次bind微信账号");
			bindweixinuserorequestdtoCall.setData(bindweixinuserorequestdtoBean);
			bindweixinuserorequestdtoCall.callService();

			Logger.verifyEquals(ECode.SUCCESS, ((Double) bindweixinuserorequestdtoCall.getMap().get("ResponseCode")).intValue() + "", "验证Code信息");
			Logger.verifyEquals(true, bindweixinuserorequestdtoCall.getMap().get("Success"), "验证操作成功");

			Logger.comment("再次bind微博账号");
			bindsinaweibouserrequestdtoCall.setData(bindsinaweibouserrequestdtoBean);
			bindsinaweibouserrequestdtoCall.callService();

			Logger.verifyEquals(ECode.SUCCESS, ((Double) bindsinaweibouserrequestdtoCall.getMap().get("ResponseCode")).intValue() + "", "验证Code信息");
			Logger.verifyEquals(true, bindsinaweibouserrequestdtoCall.getMap().get("Success"), "验证操作成功");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_UnBindThirdPartyAccountDto_009() {
		Logger.start(true, "手机注册账号，绑定微信账号，解绑成功,再绑定成功,再解绑成功");
		try {
			Logger.comment("前置条件准备");
			String phone = TestDataManager.getPhoneNum();
			List<Map> thirdParty = new ArrayList<Map>();

			String wx = "unionId_" + TestDataManager.getRandomNum(10);

			Logger.comment("创建账号,获取token");
			UserRegisterInfoRequestDtoCall urrc = JUserCallService.UserRegisterInfoRequestDtoCall(JUserCallService.initUserRegisterInfoRequestDtoBean());
			JsonObject result = urrc.getJsonObject().get("Result").getAsJsonObject();
			String token = result.get("Token").getAsString();
			int UserId = urrc.getUserid();

			Logger.comment("bind微信账号");
			BindWeiXinUseroRequestDtoBean bindweixinuserorequestdtoBean = new BindWeiXinUseroRequestDtoBean();
			BindWeiXinUseroRequestDtoCall bindweixinuserorequestdtoCall = new BindWeiXinUseroRequestDtoCall();

			bindweixinuserorequestdtoBean.setToken(token);
			bindweixinuserorequestdtoBean.setClientType("1");
			bindweixinuserorequestdtoBean.setWeiXinUser(createWeiXinUserBean(wx));

			bindweixinuserorequestdtoCall.setData(bindweixinuserorequestdtoBean);
			bindweixinuserorequestdtoCall.callService();

			Logger.verifyEquals(ECode.SUCCESS, ((Double) bindweixinuserorequestdtoCall.getMap().get("ResponseCode")).intValue() + "", "验证Code信息");
			Logger.verifyEquals(true, bindweixinuserorequestdtoCall.getMap().get("Success"), "验证操作成功");

			Logger.comment("unbind微信账号");
			unbindthirdpartyaccountdtoBean.setThirdPartyId(wx);
			unbindthirdpartyaccountdtoBean.setThirdPartyType(ThirdPartyType.WEIXIN);
			unbindthirdpartyaccountdtoBean.setUserId(UserId);

			unbindthirdpartyaccountdtoCall.setData(unbindthirdpartyaccountdtoBean);
			unbindthirdpartyaccountdtoCall.callService();

			Logger.verifyEquals(200, ((Double) unbindthirdpartyaccountdtoCall.getMap().get("ResponseCode")).intValue(), "验证Code信息");
			Logger.verifyEquals("true", unbindthirdpartyaccountdtoCall.getMap().get("Success").toString(), "验证Code信息");

			Logger.comment("再次bind微信账号");
			bindweixinuserorequestdtoCall.setData(bindweixinuserorequestdtoBean);
			bindweixinuserorequestdtoCall.callService();

			Logger.verifyEquals(ECode.SUCCESS, ((Double) bindweixinuserorequestdtoCall.getMap().get("ResponseCode")).intValue() + "", "验证Code信息");
			Logger.verifyEquals(true, bindweixinuserorequestdtoCall.getMap().get("Success"), "验证操作成功");

			Logger.comment("再次unbind微信账号");
			unbindthirdpartyaccountdtoCall.setData(unbindthirdpartyaccountdtoBean);
			unbindthirdpartyaccountdtoCall.callService();

			Logger.verifyEquals(200, ((Double) unbindthirdpartyaccountdtoCall.getMap().get("ResponseCode")).intValue(), "验证Code信息");
			Logger.verifyEquals("true", unbindthirdpartyaccountdtoCall.getMap().get("Success").toString(), "验证Code信息");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_UnBindThirdPartyAccountDto_010() {
		Logger.start(false, "用户只绑定了阿里账号，解绑阿里账号，提示不能解绑，需要设置登录信息");
		try {
			Logger.comment("前置条件准备");
			String dy = "dy_" + TestDataManager.getRandomNum(10);
			Logger.comment("创建账号,获取token");
			UserRegisterInfoRequestDtoCall urrc = JUserCallService.UserRegisterInfoRequestDtoCall(JUserCallService.initUserRegisterInfoRequestDtoBean());
			JsonObject result = urrc.getJsonObject().get("Result").getAsJsonObject();
			int uid = urrc.getUserid();

			BindThirdPartyUserReq third=JUserCallService.initBindThirdUserReq(uid);
			third.setThirdPartyType(ThirdPartyTypeEnum.TouTiao);
			third.setAppSource(AppSourceEnum.TouTiaoMiniApp);
			third.setThirdPartyId(dy);
			JUserCallService.bindThirdPartyUserCall(third);
			
			Logger.comment("unbind抖音账号");
			unbindthirdpartyaccountdtoBean.setThirdPartyId(dy);
			unbindthirdpartyaccountdtoBean.setThirdPartyType(ThirdPartyTypeEnum.TouTiao.toString());
			unbindthirdpartyaccountdtoBean.setUserId(uid);

			unbindthirdpartyaccountdtoCall.setData(unbindthirdpartyaccountdtoBean);
			unbindthirdpartyaccountdtoCall.callService();

			Logger.verifyEquals(200, ((Double) unbindthirdpartyaccountdtoCall.getMap().get("ResponseCode")).intValue(), "验证Code信息");
			// 验证thirdparty_userbind表相应记录被删除
			List<ThirdpartyUserbind> thirdinfoes1 = new JUserWapper().selectthirdpartyuserbind(uid);
			Logger.verifyEquals(0, thirdinfoes1.size(), "验证数据库中相应thirdparty_userbind记录数");

			// 验证thirdparty_userbind_history表解绑记录
			List<ThirdpartyUserbindHistory> thirdinfohistorys1 = new JUserWapper().selectthirdpartyuserbindhistory(uid);
			Logger.debug(FormatUtil.beanToGSONString(thirdinfohistorys1));
			Logger.verifyEquals(2, thirdinfohistorys1.size(), "验证数据库中相应thirdparty_userbind_History记录数");//2条 绑定和解绑
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	private void verifyDBBond(Integer uid, AliUserRequestDtoBean cq) {
		// TODO 需要检查字段
		JUserWapper ju = new JUserWapper();

		Logger.comment("验证thirdparty_userbind");
		ThirdpartyUserbind thirdinfo = ju.selectthirdpartyuserbind(uid).get(0);
		Logger.verifyEquals(cq.getSAliUserId(), thirdinfo.getThirdPartyId(), "验证ThirdPartyId");
		Logger.verifyEquals(ThirdPartyTypeEnum.Alipay.getCode(), thirdinfo.getThirdPartyType(), "验证ThirdPartyType");

		Logger.comment("验证thirdparty_userbind_history");
		ThirdpartyUserbindHistory thirdinfohist = ju.selectthirdpartyuserbindhistory(uid).get(0);
		Logger.verifyEquals(true, thirdinfohist.getBinding(), "验证binding状态");
		Logger.verifyEquals(cq.getRegSource().getCode(), thirdinfohist.getAppSource(), "验证AppSource");
		Logger.verifyEquals(cq.getClientIp(), thirdinfohist.getClientIp(), "验证ClientIp");
		Logger.verifyEquals(cq.getDeviceId(), thirdinfohist.getDeviceId(), "验证DeviceId");
		Logger.verifyEquals(cq.getSEmail(), thirdinfohist.getEmail(), "验证Email");
		Logger.verifyEquals(cq.getEquimentid(), thirdinfohist.getEquimentid(), "验证Equimentid");
		Logger.verifyEquals(cq.getSGmt_Decay(), thirdinfohist.getGmtDecay(), "验证GmtDecay");
		Logger.verifyEquals(cq.getMobile(), thirdinfohist.getLoginMobile(), "验证LoginMobile");
		Logger.verifyEquals(cq.getTerminalSource().getCode(), thirdinfohist.getTerminalSource(), "验证TerminalSource");
		Logger.verifyEquals(cq.getSThirdParty(), thirdinfohist.getThirdParty(), "验证ThirdParty");
		Logger.verifyEquals(cq.getSAliUserId(), thirdinfohist.getThirdPartyId(), "验证ThirdPartyId");
		Logger.verifyEquals(cq.getSRealName(), thirdinfohist.getThirdPartyUserName(), "验证ThirdPartyUserName");

		Logger.verifyEquals(cq.getSToken(), thirdinfohist.getThirdPartyToken(), "验证ThirdPartyToken");
		Logger.verifyEquals(cq.getSUserGradeType(), thirdinfohist.getUserGradeType(), "验证UserGradeType");
	}
}